#ifndef _BUTTON_H_
#define _BUTTON_H_

// #include "platform.h"
// #include "device.h"

// 定义ButtonModule结构体，包含函数指针
typedef struct {
    void (*Init)(void);
    uint8 (*Poll)(void);
    void (*Set_State)(Device_State state);
    ReportType (*Get_Report)(Report *report);
    bool (*IsActive)(void);
    void (*Stop)(void);
} ButtonModule;

// 宏定义，用于按钮状态
#define NUMBER_OF_BUTTONS (1)
#define BUTTON_SCHMITT_HIGH_THRESH (0xC0) /* 240 */
#define BUTTON_SCHMITT_LOW_THRESH (0x40) /* 64 */
#define BUTTON_INCREMENT (0x3F)

// 键盘布局定义
#define KEYBOARD_ROWS_SENSOR_POSITION_1 (0x2)
#define KEYBOARD_ROWS_SENSOR_POSITION_2 (0x1)

// 按钮位置宏定义
#define VOICE_BUTTON_MASK (0x1)
#define MOTION_SENSOR_BUTTON_MASK (0x2)
#define RETURN_BUTTON_MASK (0x4)

// 特殊按键代码
#define RETURN_KEY_CODE (0x9E)

#ifdef NEC_PROTOCOL
#define RETURN_IR_KEY_CODE (0x16)
#else
#define RETURN_IR_KEY_CODE (0x58)
#endif /* NEC_PROTOCOL */

// 按钮重复点击超时时间
#define BUTTON_REPEAT_TIMEOUT (108u)

extern ButtonModule button; // 声明ButtonModule的实例，命名为button

#ifndef DISABLE_BUTTON

#else
#define Button_Init()
#define Button_Poll() (0x00)
#define Button_Set_State(state)
#define Button_Get_Report(report) (NO_REPORT)
#define Button_IsActive() (false)
#define Button_Stop()
#endif /* DISABLE_BUTTON */

#endif /* _BUTTON_H_ */